Conversation
Attempt to create a buildable version of whats released in cardano-node 10.7.0.
e3189b8 to
47f2ed7
Compare
b747b36 to
441a997
Compare
In case of duplicate txids, a second invalid tx could be counted as valid because it was tracked by txid alongside the valid duplicate, conflating the two.
Add a test for ensuring that a peer can download all valid TXs when faced with two peers with conflicting tx order.
Replace the central decsision thread by having server threads coordinate between them by blocking on STM actions.
Use sharedGeneration to track if the sharedState really changed and only write to the tvar if it changed. This makes common operations like receiving and acking a txid that is already retained something that only affects the peer local state.
Remove shared states that where only written to.
Have the peer update its score during phase change. This makes State's idle calculation quicker since peers will drain back to 0. Mark pacIdlePeerScores as lazy to avoid doing the calculations when it isn't needed.
Add benchmarks for V2
Instead of traversing all peers only touch the peers that need to wake up.
Avoid copying the map when encountering an existing advertiser.
We don't need to track the ack state, it can be derived by the time we decide to ack a TX. So txAdvertisers can just be a Set member check.
Remove the tracking of advertisers in TxEntry. This change also changing how scoring is used to rank peers. A peers score affects how long time after the TX owners lease expire they can wake up and attempt to claim it. This means that acknowledgement/downloading requires minimal coordination between peers.
The first peer that advertised a new txid always got a lease on it. This is a problem since the peer may be at capacity and unable to request the TX. Update the behaviour so that anyone peer that advertise a txid can gain the first claim.
Replace the local state tvar with V1's Stateful types.
Improve comment around deletion of retaind txs.
The retained functions in Types.hs are just small wrappes around IntPSQ functions.
Use nothunks to assert that there are no thunks after some property based tests.
If there is at least one TX outstanding don't ack the final txid in the window
We don't track peers that don't have an ongoing attempt any longer so TxNoAttempt isn't needed.
Inline some hot path functions. The old NOINLINE pragmas where a leftover from V1, and not applicable to V2 since we don't run unsafeNoThunks between states.
Not only idle peers but all peers should be notified when something changes for one of their TX.s
When picking TXs to submit to the mempool stop at gaps. When picking TXs to download use the peer's advertisement order as a guide, not the TxKey order.
Test the peer score functionality. Use arbitrary TxDecisionPolicy instead of the defaultTxDecisionPolicy.
086f290 to
cff5d5d
Compare
When peers have conflicting advertisement orders for TXs it is possible for them to form a dependancy loop. For example peer A has tx id 1 but requires tx id 0 to submit, peer B has txid 2 but requires tx id 1 to submit, peer C has txid 0 but requires txid 2 before it can submit. We break this loop by introducing a inflightTimeout. When a peer has spent that much time unable to get the TX into the mempool it will bump the new currentMaxInflightMultiplicity limit. This will allow another peer to issue a new request for the TX.
Add tests that verify that V2 is robust even if peers are late or omit TXs in replies.
Add prop_txSubmission_score_impairment which verifies TX submisssion V2's scoring functionality.
Test nextPeerAction but running it through a series of triggers for a small group of peers.
checkNoThunks was always true, unsafeNoThunks wasn't really called. seq forces val to WHNF, but deeper thunks will be detected.
With no-thunk checks in prop_nextPeerAction_processesAllTriggers the prop_nextPeerAction_prioritisesSubmit isn't needed.
Convert trivial nextPeerAction_claimsRejectedTxFromOtherAdvertiser to a unit tests.
Fold prop_nextPeerAction_claimsExpiredLease into prop_nextPeerAction_claimsClaimableTx which is expanded to cover both case which is expanded to cover both casess
Convert the direct server benchmark into one that can run multiple peers with async.
Avoid Double conversions, similar to muxs diffTimeToMicroseconds.
Use IntSet for faster lookups for retained keys. IntPSQ is still needed for quick removal of expeired entries.
Reduce STM contention in V2 TxSubmission inbound by splitting per-peer in-flight bookkeeping out of SharedTxState into a small per-peer PeerTxInFlight TVar. SharedTxState is now only written when the shared state updates. The common case of a new peer advertising an existing txid is just a read operation for the shared state and a write operation into the peer local TVar.
Break out mempoolGetSnapshot into its own atomic transaction.
Add the conter thread to the test cases. Add meta tests for AppV2 generators/shrinkers
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Txsubmission V2, but without a central decision thread.
WIP. WIP. WIP.
Checklist
Quality
Maintenance
ouroboros-networkproject.